import { request } from '../utils/request';
import { apiVirtualSuccessAccess, useVirtualAccess } from '../utils/tools';

export async function queryListData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      pagesize: 10,
      total: 645,
      nowpageindex: 1,
      data: [
        {
          rowId: 1,
          intreguserid: 81458,
          chvparentid: 78852,
          chvsex: '1',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIkqxY5Wm9DNdjYR8qCreiaZGeg6KXsoLZUqqXdKJ8jfX9icalgh5lYanibV04wzt2xbxuO2RCua2Yag/132',
          chvnickname: '孤宇',
          chvcity: '浦东新区',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:25:22.087',
        },
        {
          rowId: 2,
          intreguserid: 81457,
          chvparentid: 1890,
          chvsex: '2',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eq2wcNOceqlXsRaiawdRIPQN29yth5GegOOJn6u0c3ThPHGFibE56X2dbdCt05RibnfGJxwUVYCdg3Jw/132',
          chvnickname: '大.潘',
          chvcity: '',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:24:53.103',
        },
        {
          rowId: 3,
          intreguserid: 81456,
          chvparentid: 0,
          chvsex: '1',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIGGX0StBKwa1rs7fICFwFGk172ljdB2QeYv7MQoClhaYvtAwlkmeSH6mepguyzeNQQ6lO5RWcfuw/132',
          chvnickname: '沧海',
          chvcity: '郑州',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:24:16.867',
        },
        {
          rowId: 4,
          intreguserid: 81455,
          chvparentid: 49544,
          chvsex: '2',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTLmBYq5IkXzE5za50x9x8qddt8e2OOa58kIeKrzmY2pY4haJLBb0gb6I4byUbQa83YwjZXwsT0rRg/132',
          chvnickname: '依栏观花',
          chvcity: '',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:22:06.257',
        },
        {
          rowId: 5,
          intreguserid: 81454,
          chvparentid: 3080,
          chvsex: '0',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/Cz2BSzllb9B9AqVLI7X4EgicQDbB44A42RxoDQD1vD9EspMBjdbjx3dtDUqBZoMXK16agBRNK0UQKe6IQxyRbcQ/132',
          chvnickname: '张宁 翡翠珠宝专卖',
          chvcity: '',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:21:42.447',
        },
        {
          rowId: 6,
          intreguserid: 81453,
          chvparentid: 3080,
          chvsex: '0',
          chvheadimgurl: '',
          chvnickname: '古董小件店',
          chvcity: '',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:20:03.273',
        },
        {
          rowId: 7,
          intreguserid: 81452,
          chvparentid: 20926,
          chvsex: '2',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83epLTiclfmSxicklVbYria1aButlhxMNxaD89Ey4icvGADYqhicIDFibrdY6bjT66FVHuNfbdgCF29icRRDnA/132',
          chvnickname: '蓓蓓',
          chvcity: '郑州',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:15:09.603',
        },
        {
          rowId: 8,
          intreguserid: 81451,
          chvparentid: 0,
          chvsex: '1',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/PpFLIPhXcATIhK1JxlBFYIa3FkDeQ6Zic7iarmzIq3raVb53AkYcGUKT6gAca9F5Z6yiaYpnCHiaZA3EZZicHthAia9A/132',
          chvnickname: '蓝色',
          chvcity: '郑州',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:14:41.837',
        },
        {
          rowId: 9,
          intreguserid: 81450,
          chvparentid: 76430,
          chvsex: '2',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/7SrsicCyRDrg0f0DuGCfichkwQ0Bq6RJA3yicHibk68gAx2cLGVQF8f3tQeOROzqmkzUSxeheiamtlBMfKwj6gn4Oaw/132',
          chvnickname: '珍爱你',
          chvcity: '郑州',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:10:14.523',
        },
        {
          rowId: 10,
          intreguserid: 81449,
          chvparentid: 77700,
          chvsex: '2',
          chvheadimgurl:
            'http://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eqE7lDLOiac5icicLQ5JMSO1dDkFLf4xeJxqAv9MTGEdURcMWZNyFbdYcniaI5NoJ5M3tD3IKXFDnIplw/132',
          chvnickname: '小仙吕',
          chvcity: '郑州',
          intintegral: 0,
          inttype: 0,
          dtmintime: '2018-11-15T17:08:28.18',
        },
      ],
    });

    return result;
  }

  return request('/api/Consumer/List', {
    method: 'POST',
    body: params,
  });
}

export async function queryGetData(params) {
  if (useVirtualAccess()) {
    const result = await apiVirtualSuccessAccess({
      data: {
        rowId: 2,
        intreguserid: 81457,
        chvparentid: 1890,
        chvsex: '2',
        chvheadimgurl:
          'http://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83eq2wcNOceqlXsRaiawdRIPQN29yth5GegOOJn6u0c3ThPHGFibE56X2dbdCt05RibnfGJxwUVYCdg3Jw/132',
        chvnickname: '大.潘',
        chvcity: '',
        intintegral: 0,
        inttype: 0,
        dtmintime: '2018-11-15T17:24:53.103',
      },
    });

    return result;
  }

  return request('/api/Consumer/Get', {
    method: 'POST',
    body: params,
  });
}

export async function updateBasicInfoData(params) {
  return request('/api/ProductOrder/updateBasicInfo', {
    method: 'POST',
    body: params,
  });
}

export async function updateBalanceInfoData(params) {
  return request('/api/ProductOrder/updateBalanceInfo', {
    method: 'POST',
    body: params,
  });
}

/**
 * 占位函数
 *
 * @export
 * @returns
 */
export async function empty() {
  return {};
}
